<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: baiyu
  Date: 2021/10/30
  Time: 9:07 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>查询全部服务</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
          integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <script type="text/javascript">
        function update01(serviceId) {
            alert("点击了按钮，选择的id为：" + serviceId)
        }
    </script>
    <style>
        .table th, .table td {

            text-align: center;

            vertical-align: middle !important;

        }
    </style>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>显示他妈的所有服务</small>
                </h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 column">
                <a class="btn btn-success" href="${pageContext.request.contextPath}/service/toAdd">再来一个</a>
            </div>
            <div class="col-md-4 column">
                <form class="form-inline" action="${pageContext.request.contextPath}/service/queryServiceByName"
                      method="post" style="float: right">
                    <label>
                        <input type="text" name="serviceName" class="form-control" placeholder="输入要查询的服务名称">
                    </label>
                    <input type="submit" value="查询" class="btn btn-success">
                </form>
            </div>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>服务id</th>
                    <th>ip地址</th>
                    <th>服务端口</th>
                    <th>服务名称</th>
                    <th>服务信息</th>
                    <th>是否在用</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="service" items="${list}">
                    <tr>
                        <td>${service.id}</td>
                        <td>${service.ip}</td>
                        <td>${service.port}</td>
                        <td>${service.name}</td>
                        <td>${service.information}</td>
                        <td>${service.isUse}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/service/toUpdate?serviceId=${service.id}">修改</a>
                            &nbsp;|&nbsp;
                            <a href="${pageContext.request.contextPath}/service/delete?serviceId=${service.id}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>

</body>
</html>
